{include file="header.tpl"}
{if $core->nodePartOf("comments/add")}{include file="comments_add.tpl"}
{else}
<div class="page_header">Add Comment</div>
<p>
<form name="frmcomments" method="post" action=".?n=comments/add&process=1">
<table class="inline">
<tr>
<th>Name</th>
<td><input type="text" name="name" {if $core->session->isLoggedIn()}value="{$smarty.session.username}"{/if} /></td>
</tr>
<tr>
<th>Title</th>
<td><input type="text" name="title" /></td>
</tr>
<tr>
<th>Comment</th>
<td><textarea name="comment" cols="40" rows="6"></textarea></td>
</tr>
</table>
<input type="hidden" name="postid" value="{$smarty.get.id}" />
<input type="submit" name="Submit" value="Submit" />
</form>
</p>
&nbsp;
<div class="page_header">View Comments</div>
{assign var="comments" value=$core->database->get_comments($smarty.get.id)}
{if !$comments}
<p>No comments for this news post</p>
{else}
{section name=comments loop=$comments} 
<p>{$comments[comments].username}<br />
{$comments[comments].timestamp}<br />
{$comments[comments].title}<br />
{$comments[comments].body}</p>
{/section}
{/if}
{/if}
{include file="footer.tpl"}